<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.lmpop.trade.ti_link.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Ti_link ti_link = new Ti_link();
	String l_name = "";
	if(request.getParameter("link_name")!=null && !request.getParameter("link_name").equals("")){
		l_name = request.getParameter("link_name");
		ti_link.setLink_name(l_name);
	}
	String s_display = "";
	if(request.getParameter("i_display")!=null && !request.getParameter("i_display").equals("")){
		s_display = request.getParameter("i_display");
		ti_link.setIs_display(s_display);
	}	
	Ti_linkInfo ti_linkInfo = new Ti_linkInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_linkInfo.getListByPage(ti_link,Integer.parseInt(iStart),limit);
	int counter = ti_linkInfo.getCountByObj(ti_link);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?link_name="+l_name+"&i_display="+s_display+"&iStart=",Integer.parseInt(iStart),limit);
%>
<html>
  <head>
    <title>友情链接管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="link.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>友情链接管理</h1>
			</td>		
			<td>
				<a href="addInfo.jsp"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				名称:<input name="link_name" id="link_name" type="text" />
				是否显示:<select name="i_display" id="i_display">
				<option value="">请选择</option>
				<option value="0">是</ option>	
				<option value="1">否</ option>
				</select>
				<input name="searchInfo" type="button" value="查询" onClick="return search();"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	

	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td  width="90%">
				<input type="button" name="delInfo" onClick="delIndexInfo()" value="删除" class="buttab"/>
				<input type="button" name="sortN" onClick="sortNews(this)" value="排序" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onClick="selectAll()"></th>
			
		  	<th>名称</th>
			
			<th>分组名称</th>
		  	
		  	<th>链接地址</th>
		  	
		  	<th>排序</th>
		  	
		  	<th>是否显示</th>
		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>		
		
		<% 
			for(int i=0;i<list.size();i++){
				Hashtable map = (Hashtable)list.get(i);
				String link_id="",group_id="",group_name="",link_name="",link_url="",link_no="",is_display="",display="";
					if(map.get("link_id")!=null) link_id = map.get("link_id").toString();
					if(map.get("group_id")!=null) group_id = map.get("group_id").toString();
					if(map.get("group_name")!=null) group_name = map.get("group_name").toString();
					if(map.get("link_name")!=null) link_name = map.get("link_name").toString();
					if(map.get("link_url")!=null) link_url = map.get("link_url").toString();
					if(map.get("link_no")!=null) link_no = map.get("link_no").toString();
					if(map.get("is_display")!=null) is_display = map.get("is_display").toString();
					if(is_display.equals("0")){display="是";}
					if(is_display.equals("1")){display="否";}

		%>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=link_id %>" /></td>
			
		  	<td><a href="<%=link_url%>" target="_blank"><%=link_name%></a></td>
		  	
			<td><%=group_name%></td>
			
		  	<td><a href="<%=link_url%>" target="_blank"><%=link_url%></a></td>
		  	
		  	<td><input type="text" id="<%=link_id%>" name="<%=link_id%>" value="<%=link_no%>" size="4" maxlength="2" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"></td>
		  	
		  	<td><%=display%></td>
		  	
			<td width="10%"><a href="updateInfo.jsp?link_id=<%=link_id%> &up_group_id=<%=group_id%>&link_name=<%=java.net.URLEncoder.encode(l_name)%>&i_display=<%=s_display%>&iStart=<%=iStart%>"><img src="/program/admin/images/edit.gif" title="修改" border="0"/></a></td>
	  		<td width="10%"><a href="javascript:delOneNews('<%=link_id%>');"><img src="/program/admin/images/delete.gif" title="删除" border="0"/></a></td>
		</tr>
		
		  <%
		  		}
		  %>
	<%
		 }
	%>  
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onClick="delIndexInfo()" value="删除" class="buttab"/>
				<input type="button" name="sortN" onClick="sortNews(this)" value="排序" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	

	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="sort" id="sort" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="6382" />
	  </form>
</body>

</html>